﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace EFong.Contract
{
    [DataContract]
    public class PFlightOrderDetail
    {
        private DateTime? _出发日期;
        [DataMember]
        public DateTime? 出发日期
        {
            get
            {
                return _出发日期;
            }
            set
            {
                _出发日期 = value;
            }
        }

        private string _departLocation = string.Empty;
        [DataMember]
        public string DepartLocation
        {
            get { return _departLocation; }
            set { _departLocation = value; }
        }

        private string _destination = string.Empty;
        [DataMember]
        public string Destination
        {
            get { return _destination; }
            set { _destination = value; }
        }

        private string _passengerText = string.Empty;
        [DataMember]
        public string PassengerText
        {
            get { return _passengerText; }
            set { _passengerText = value; }
        }

        private string _flightNo = string.Empty;
        [DataMember]
        public string FlightNo
        {
            get { return _flightNo; }
            set { _flightNo = value; }
        }

        public string 行程
        {
            get
            {
                return string.Format("{0} 至 {1}", this.DepartLocation, this.Destination);
            }
        }

        private int _seq;
        [DataMember]
        public int Seq
        {
            get { return _seq; }
            set { _seq = value; }
        }

        private decimal _tax;
        [DataMember]
        public decimal Tax
        {
            get { return _tax; }
            set { _tax = value; }
        }

        public decimal DTax
        {
            get 
            {
                if (Seq != 0)
                    return 0;
                else
                    return _tax;
            }
        }

        private decimal _dPrice;
        [DataMember]
        public decimal DPrice
        {
            get { return _dPrice; }
            set { _dPrice = value; }
        }

        public decimal Price
        {
            get
            {
                if (Seq != 0)
                    return 0;
                else
                    return DPrice;
            }
        }

        private decimal _dInsuranceFee;
        [DataMember]
        public decimal DInsuranceFee
        {
            get { return _dInsuranceFee; }
            set { _dInsuranceFee = value; }
        }

        public string InsuranceFee
        {
            get
            {
                if (Seq != 0)
                    return "0";
                else
                {
                    if (IsInsurancePolicyFree)
                        return "送";
                    else
                        return DInsuranceFee.ToString("#.##");
                }
            }
        }

        private bool _IsInsurancePolicyFree;
        [DataMember]
        public bool IsInsurancePolicyFree
        {
            get { return _IsInsurancePolicyFree; }
            set { _IsInsurancePolicyFree = value; }
        }

        public string InsurancePolicyState
        {
            get
            {
                if (Seq != 0)
                    return string.Empty;
                else if (IsInsurancePolicyFree)
                    return "送";
                else
                    return string.Empty;
            }
        }
    }
}
